package com.longtop.sp.mapdao.impl;

import java.util.Map;

import org.springframework.jdbc.core.JdbcTemplate;

import com.longtop.sp.mapdao.MapVO;
import com.longtop.sp.mapdao.Operate;
import com.longtop.sp.mapdao.meta.PrimaryKeyFactory;

public abstract class AbstractOperate implements Operate {
	protected MapVO vo = null;
	protected JdbcTemplate jdbcTemplate;
	protected String tableName = null;
	protected Map tmData = null;
	protected PrimaryKeyFactory pkFactory;

	public void setPkFactory(PrimaryKeyFactory pkFactory) {
		this.pkFactory = pkFactory;
	}

	public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
		this.jdbcTemplate = jdbcTemplate;
	}

	public void setMapVO(MapVO vo) {
		this.vo = vo;
		tableName = vo.getTableName();
		tmData = vo.getData();
	}

	public int execute() throws Exception {
		return executeImpl();
	}

	public abstract int executeImpl() throws Exception;
}